import { PointerEvent, App } from "leafer-ui";
import { ITool, IToolConfig } from "../types";
export const EaserTool: ITool = ({ app, config, historyUtil ,box}) => {
  const hanClick = (e: PointerEvent) => {
    e.target.remove();
    historyUtil.commit(box.toJSON());
  };
  const eventsMap = {
    [PointerEvent.CLICK]: hanClick,
  };
  return {
    eventsMap,
    active: () => {
      // app.editor.lock()
      app.editor.config.selector = false;
    },
    deactive: () => {
      // app.editor.unlock();
      app.editor.config.selector = true;
    },
  };
};
